home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekkan Dennou Club 147
/
Gekkan Dennou Club - 2000.8 Vol. 147 (Japan).7z
/
Gekkan Dennou Club - 2000.8 Vol. 147 (Japan) (Track 1).bin
/
tools
/
ex68v209
/
ex68v209.lzh
/
X6_UTIL.LZH
/
getrom.c
next >
Wrap
Text File
|
2000-05-13
|
1KB
|
59 lines
#include <stdio.h>
#include <stdlib.h>
#include <mem.h>
#define BUFFSIZE 0x4000
int exw(unsigned char *pt,int len,FILE *fp)
{
unsigned char *buff;
int block;
int total;
total=0;
buff=(unsigned char *)malloc(BUFFSIZE);
if (buff==NULL)
return -1;
while(len>0)
{
block=BUFFSIZE;
if (len<BUFFSIZE)
block=len;
memcpy(buff,pt,block);
if (fwrite(buff,1,block,fp)!=block)
{
free(buff);
return -1;
}
total+=block;
len-=block;
pt=&pt[block];
}
free(buff);
return total;
}
void main()
{
FILE *fp;
int ssp;
ssp=SUPER(0);
fp=fopen("cg.rom","wb");
if (fp==NULL) exit(1);
if (exw((unsigned char *)0xf00000,0xc0000,fp) != 0xc0000)
exit(1);
fclose(fp);
fp=fopen("boot.rom","wb");
if (fp==NULL) exit(1);
if (exw((unsigned char *)0xfe0000,0x20000,fp) != 0x20000)
exit(1);
fp=fopen("sram.ram","wb");
if (fp==NULL) exit(1);
if (exw((unsigned char *)0xed0000,0x4000,fp) != 0x4000)
exit(1);
fclose(fp);
SUPER(ssp);
}